import React, { Component } from 'react'
import Child1 from '../component/Child1';
import Child2 from '../component/Child2';
import Child3 from '../component/Child3';
import Child4 from '../component/Child4';
export default class Parent extends Component {
    constructor(props){
        super(props);
        this.state={
            num:10
        }
    }
    add=()=>{
        this.setState({
            num:this.state.num+1
        })
        // console.log(123)
    }
  render() {
    return (
        <>
      <div>Parent按钮<button onClick={()=>{this.add()}}>修改</button></div>
      <div>父组件的num值：{this.state.num}</div>
      <Child1 num={this.state.num}></Child1>
      <Child2 num={this.state.num}></Child2>
      <Child3 num={this.state.num}></Child3>
      <Child4 num={this.state.num}></Child4>
      </>
    )
  }
}
